/*
 ------------------------------------------------------------------------------
	winmad++ -	a test program for using SDL and mad library on Windows
				with object oriented UI style
				with low level mad (seek)

	Copyright (C) 2011 Pierre Veber
	
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software Foundation,
	Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
------------------------------------------------------------------------------
*/

#define _CRT_SECURE_NO_WARNINGS

#pragma once

#include <fcntl.h>
#include <stdio.h>

#ifdef WIN32

#define _WIN32_IE 0x0700
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501

#include <tchar.h>
#include <windows.h>
#include <mmsystem.h>
#define usleep(x)	Sleep((DWORD)(x/1000))
#else

#include <alsa/asoundlib.h>
#define _strdup strdup
#define _strndup strndup

#endif

#define TRACE_WMM		0x00000001
#define TRACE_MP3		0x00000002
#define TRACE_UI		0x00000004
#define TRACE_STYLE		0x00000008

#define TRACE_FILTER (TRACE_MP3)

#ifdef _DEBUG
#ifdef WIN32
#define TRACE(msg, ...)	if (THIS_FILTER	& TRACE_FILTER) \
						{ \
							TCHAR szOutput[1024]; \
							_stprintf_s(szOutput, 1024, _T(msg), __VA_ARGS__); \
							OutputDebugString(szOutput); \
						}
#else
#define TRACE(msg, ...)	if (THIS_FILTER & TRACE_FILTER) \
						{ \
							printf(msg, __VA_ARGS__); \
						}
#endif
#else
#define TRACE(msg, ...)
#endif

#include "mad/mad.h"
#include "mad/id3tag.h"

#include "SDL/SDL.h"
#include "SDL/SDL_thread.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"

#include "audio.h"
#include "util.h"
#include "style.h"
#include "ui.h"
